<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       //7.ES6中的集合对象(Map):和json相似，也是和一种key-value形式，Map对象就是为了和for...of...语法结合使用的
        var map = new Map();
        //向Map集合中添加元素：set(name,value)方法
        map.set("a","apple");
        map.set("b","banana");
        //获取Map中的元素get(name)
        console.log(map.get("a"));
        //删除元素
        // map.delete("a");

        //可以结合for......of.....对Map遍历
        for(var name of map){
            console.log(name);
        }

        for(var [key,value] of map){
            console.log(key,value);
        }

        for(var name of map.entries()){
            console.log(name);
        }

        for(var [key,value] of map.entries()){
            console.log(key,value);
        }

        for(var key of map.keys()){
            console.log(key)
        }

        for(var val of map.values()){
            console.log(val)
        }

    
     
    </script>
</head>
<body>

</body>
</html>